{{indexmenu_n>8}}

===== Raspberry Pi 2/3 =====

2020/12/06

**Important Note.**

This is about Raspberry 3, which runs the armhf architecture. See [[:opencpn:opencpn_user_manual:getting_started:opencpn_installation:rpi4|Raspberry Pie 4]] for 64-bit build environments on RPi-4

==== Installing Raspbian ====

OpenCPN works on Raspberry Pi 2, 3 and 4 models. You can install OpenCPN adding an Ubuntu PPA (Personal Packages Archives) to your system's Software Sources. We will see how to do this but first of all you need to have a running system.

Raspbian is the official Operating System for Raspberry Pi. You have two options to install Raspbian on an SD card: with NOOBS (New Out Of Box Software) or installing an SD image directly. We recommend NOOBS.

Follow this easy guide for both options: [[https://www.raspberrypi.org/learning/software-guide/quickstart/|https://www.raspberrypi.org/learning/software-guide/quickstart/]] Then you will need to install OpenCPN Ubuntu PPA.

If you feel lazy you can try [[https://openplotter.readthedocs.io/en/latest/|OpenPlotter]], a complete marine Operating System for Raspberry Pi with OpenCPN + plugins installed and amazing extra tools ready to use.


==== OpenPlotter ====

You can download OpenPlotter as a [[https://openplotter.readthedocs.io/en/latest/getting_started/downloading.html#raspberry-pi-images|ready-to-work SD image]] or install it[[https://openplotter.readthedocs.io/en/latest/getting_started/downloading.html#desktop-and-laptop| manually on any Debian-derived system]].


==== Apt-Key Deprecated - May 2018 ====

See [[http://www.cruisersforum.com/forums/f134/opencpn-version-4-8-4-released-200246-2.html#post2627925|http://www.cruisersforum.com/forums/f134/opencpn-version-4-8-4-released-200246-2.html#post2627925]] and the later posts from bdbcat and CaptRon. [[https://askubuntu.com/questions/13065/how-do-i-fix-the-gpg-error-no-pubkey|How do I fix the GPG error “NO_PUBKEY”?]] Apt-key is deprecated, see [[https://www.raspberrypi.org/forums/viewtopic.php?t=193536|gpg: keyserver receive failed: No dirmngr]] and [[https://askubuntu.com/questions/308760/w-gpg-error-http-ppa-launchpad-net-precise-release-the-following-signatures/|GPG error: http://ppa.launchpad.net precise Release: The following signatures couldn't be verified because the public key is not available]]

==== Adding OpenCPN Ubuntu PPA to Raspbian Software Sources ====

Once you have Raspbian running on Raspberry Pi, go to Menu → Accessories → Terminal, and type:

<code>
sudo nano /etc/apt/sources.list

</code>

A text editor will open. Move the cursor to the end and add this line and add a record for PPA repository compatible with your Rasbbian release. If you are on Raspbian Stretch, the compatible Ubuntu release is Xenial, for Raspbian Buster it is Bionic. The exactl record to add can be obtained from the Technical details section of\\
[[https://launchpad.net/~opencpn/+archive/ubuntu/opencpn|https://launchpad.net/~opencpn/+archive/ubuntu/opencpn]] and will be similar to
<code>

deb https://ppa.launchpadcontent.net/opencpn/opencpn/ubuntu focal main

</code>

Save the file pressing Ctrl X, say Yes and press enter. Now type:

<code>
sudo apt install dirmngr

</code>

(A certificate management service, needed for the next command) Then type

<code>
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C865EB40

</code>

and press enter. Now be sure you have Internet connection and type:

<code>
sudo apt-get update

</code>

The Software sources will be updated and finally you will have to type:

<code>
sudo apt-get install opencpn

</code>

**and you are done!**


==== RPI HAT & GPS setup ====

See [[https://www.cruisersforum.com/forums/f134/rpi-hat-what-interface-for-gnss-244280.html#post3307322|https://www.cruisersforum.com/forums/f134/rpi-hat-what-interface-for-gnss-244280.html#post3307322]]

For direct implementation with OpenCPN the easiest path is NMEA 0183, this is supported natively and directly by OpenCPN - no other decoding software widget would be required. O recognizes serial ports on the host directly - this is built-in functionality. On the NEO 8 NMEA is available on both the UART and USB interfaces:

=== UART ===

9600 baud, 8 bits, no parity bit, 1 stop bit. Configured to transmit both NMEA and UBX protocols, but only the following NMEA (and no UBX) messages have been activated at start-up: GGA, GLL, GSA, GSV, RMC, VTG, TXT

=== USB ===

Configured to transmit both NMEA and UBX protocols, but only the following NMEA (and no UBX) messages have been activated at start-up: GGA, GLL, GSA, GSV, RMC, VTG, TXT USB power mode: bus-powered On Linux OpenCPN should be able to access either port with built-in drivers, not much difference and not much configuration required, so whichever is easier to implement in the hat.

If, for some reason, you want to use SPI/DDC you could use the OpenPlotter installation to add some I2C support or write your own code, but that is a more difficult path for the stated purpose of integration with O (but there may be other reasons depending on alternate uses for your project).

===== Installing plugins =====

To install or update plugins, use the Plugin-Manager of openCPN. Go to Options → Plugins and update the Plugin Catalog: Master. Scroll the plugin list to find the plugin you want to install or update. A green up arrow indicates that there is an update available. Select the the plugin and install or update it. Finally, enable the plugin.

==== Advanced ====

=== SD Cards ===

It is suggested to use [[http://www.cruisersforum.com/forums/f134/raspberry-pi-w-opencpn-208244.html#post2786393|'High Endurance' microSDHC cards]]. Google 'Wear Level' on SD cards to discover more information.

=== OpenGL acceleration ===

The latest version of Raspbian based on Debian Buster has OpenGL enabled by default if you are running it on a Raspberry 4.

=== Compiling OpenCPN on Raspberry Pi ===

[[https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:developer_manual:developer_guide:compiling_linux:rpi2|https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:developer_manual:developer_guide:compiling_linux:rpi2]]

=== Slow ENC Vector chart display ===

  * Change the chart directories from ONE top-level choice to many. For the US ENC's, I did this based on the CG districts.
  * Set up chart groups. I ended up with "US East Coast", "US West Coast", etc, a total of about 10 groups for the charts I have. This had the single largest effect!
  * Turn on OpenGL. Also a large effect.
  * Move Raspbian from an SD card to an SSD. It is plugged in to one of the USB 3.1 ports on the Pi. This actually made a relatively small difference.

